package com.questetra.bpms.air.model
{
    public class WorkitemForm
    {
        public function WorkitemForm()
        {
        }

        private var _nodeNumber:Number;
        private var _taskName:String;

        private var _processInstanceId:Number;
//        private var _workitemId:Number;

        private var _title:String;

        private var _formDatas:Array /* as FormData */ = [];

        public function xmlToObject(xml:XML):void
        {
            this.nodeNumber = xml["node-number"];
            this.taskName = xml["task-name"];
//            this.workitemId = xml["workitem-id"];

            var childrenXML:XMLList = xml.children();
            var childXML:XML;
            for each (childXML in childrenXML)
            {
                if (childXML.localName() == "form-data")
                {
                    var formData:FormData = new FormData();
                    formData.xmlToObject(childXML);
                    this.formDatas.push(formData);
                    this.processInstanceId = formData.processInstanceId;
                }
            }
        }

        public function set taskName(value:String):void
        {
            this._taskName = value;
        }
        public function get taskName():String
        {
            return this._taskName;
        }
        public function set nodeNumber(value:Number):void
        {
            this._nodeNumber = value;
        }
        public function get nodeNumber():Number
        {
            return this._nodeNumber;
        }

        public function set processInstanceId(value:Number):void
        {
            this._processInstanceId = value;
        }
        public function get processInstanceId():Number
        {
            return this._processInstanceId;
        }
//        public function set workitemId(value:Number):void
//        {
//            this._workitemId = value;
//        }
//        public function get workitemId():Number
//        {
//            return this._workitemId;
//        }

        public function set title(value:String):void
        {
            this._title = value;
        }
        public function get title():String
        {
            return this._title;
        }

        public function set formDatas(value:Array /* as FormData */):void
        {
            this._formDatas = value;
        }
        public function get formDatas():Array /* as FormData */
        {
            return this._formDatas;
        }
    }
}